function submitPage(obj, type) {
	var ids = "";
	$("[name='id']").each(function() {
		ids += $(this).val() + ",";
	});
	API.icdDiseaseSymptomDescriptionSubmitPage({
		"ids" : ids
	}, function(res) {
		UTIL.releaseButton(obj);
		if (res.code == '0') {
			window.location.reload();
			UTIL.releaseButton(obj);
			return true;
		} else {
			alert(res.desc);
		}
	});
}

function changeArray(obj) {
	var arr = $(obj).val();
	var id = $(obj).attr("name");
	API.icdDiseaseSymptomDescriptionChangeArray({
		"id" : id,
		"array" : arr
	}, function(res) {
		UTIL.releaseButton(obj);
		if (res.code == '0') {
			window.location.reload();
			UTIL.releaseButton(obj);
			return true;
		} else {
			alert(res.desc);
		}
	});
}

$(document).ready(function() {
	$(".contenttext").mouseup(function(e) {
		var txt;
		var parentOffset = $(this).offset();
		var id = $(this).attr("name");
		var x = e.pageX - parentOffset.left;
		var y = e.pageY - parentOffset.top;
		txt = window.getSelection();
		if (txt.toString().length > 0) {
			// 分词
			API.icdDiseaseSymptomDescriptionSplit({
				"text" : txt.toString(),
				"id" : id
			}, function(res) {
				if (res.code == '0') {
					window.location.reload();
					UTIL.releaseButton(obj);
					return true;
				} else {
					alert(res.desc);
				}
			});
		}
	});
});
